Hands-On Chatbot Development with Alexa Skills and Amazon Lex by Sam Williams

Hands-On Chatbot Development with Alexa Skills and Amazon Lex by Sam Williams

Author:Sam Williams
Language: eng
Format: epub
Tags: COM051260 - COMPUTERS / Programming Languages / JavaScript, COM004000 - COMPUTERS / Intelligence (AI) and Semantics, COM060080 - COMPUTERS / Web / General
Publisher: Packt Publishing
Published: 2018-09-27T12:41:52+00:00


return new Promise((resolve, reject) => {

// do something

resolve(success);

reject(failure);

})

We can put our s3.getObject() code inside this Promise, resolving handleS3Data() and rejecting handleS3Error():

return new Promise((resolve, reject) => {

s3.getObject(params, function(err, data) {

if (err) { // an error occurred

reject(handleS3Error(err));

} else { // successful response

console.log(data);

resolve(handleS3Data(data, intentName));

}

});

})

We now need to create the two handlers for the S3 responses. These functions can be created after the handler:

const handleS3Error = err => {

}



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.